/*
 * @Author: 杰编程 2306248989@qq.com
 * @Date: 2023-08-05 21:12:56
 * @LastEditors: 杰编程 2306248989@qq.com
 * @LastEditTime: 2023-08-05 21:37:29
 * @FilePath: /lesson24/2. tcp/task.hpp
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#pragma once

#include <string>
#include<functional>

class Task
{
    using func_t =std::function<void(int,std::string)>;
public:
    Task() = default;

    Task(func_t fun,int sockfd,const std::string& name):_fun(fun),_name(name),_sockfd(sockfd)
    {
    }

    void operator()()
    {
        _fun(_sockfd,_name);
    }

private:
    func_t _fun;
    int _sockfd;
    std::string _name;
};